package avicit.bdp.dcs.detail.rest;

import avicit.bdp.dcs.detail.dto.TableDetailDto;
import avicit.bdp.dcs.detail.service.TaskTableDetailService;
import avicit.platform6.core.rest.msg.QueryRespBean;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-08-03 11:19
 * @类说明：表结构明细接口
 * @修改记录：
 */
@RestController
@RequestMapping("/api/bdp/dcs/detail/TaskTableDetailRest")
@Api(tags = "表结构明细接口")
public class TaskTableDetailRest {

    private static final Logger logger = LoggerFactory.getLogger(TaskTableDetailRest.class);

    @Autowired
    private TaskTableDetailService taskTableDetailService;

    @GetMapping("/getTaskTableDetailList")
    @ApiOperation(value = "查询表结构迁移详情")
    public ResponseMsg<QueryRespBean<TableDetailDto>> getTaskTableDetailList(@ApiParam(value = "jobId", name = "jobId", required = true) @RequestParam String jobId,
                                                                             @ApiParam(value = "源表名", name = "srcTableName") @RequestParam(required = false) String srcTableName,
                                                                             @ApiParam(value = "当前页", name = "currentPage", required = true)  @RequestParam(defaultValue = "1") Integer currentPage,
                                                                             @ApiParam(value = "每页显示条数", name = "pageSize", required = true) @RequestParam(defaultValue = "10") Integer pageSize) {
        ResponseMsg<QueryRespBean<TableDetailDto>> responseMsg = new ResponseMsg<>();
        QueryRespBean<TableDetailDto> queryRespBean = taskTableDetailService.getTaskTableDetailListByJobIdPage(jobId, srcTableName, currentPage, pageSize);
        responseMsg.setResponseBody(queryRespBean);
        return responseMsg;
    }

}
